package com.cc.springboot.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.cc.springboot.entity.UserEntity;
import com.cc.springboot.mapper.UserMapper;
import com.cc.springboot.service.UserService;

@Controller
public class IndexController {
	
	@Autowired
	private UserMapper userMapper;
	@Autowired
	private UserService userService;

	@ResponseBody
	@RequestMapping("/getUserName")
	public UserEntity getUserName(String name) {
		return userMapper.findByName(name);

	}
	
	@ResponseBody
	@RequestMapping("/inserUser")
	public String addUser(Integer id,String name) {
		 userService.addUser(id, name);
		 return "success";

	}
}
